""" 注意0的阶乘为1 """


# 方法1 不使用递归
def main_1(num):
    if num == 0:
        print("1")
    elif num == 1:
        print("1")
    else:
        result = 1
        for i in range(1, num + 1):
            result = result * i
        print(result)


# 方法2 使用递归
def main_2(num):
    if num == 0:
        return 1
    elif num == 1:
        return 1
    else:
        return num * main_2(num - 1)


main_1(4)
